6-1

class MyThread extends Thread{
	private int n;
	public  void run(){
		for(int i=0;i<n;i++)
			System.out.println(i);
		System.out.println(Thread.currentThread().getName()+" "+isAlive());
	}

	public MyThread(int n) {
		this.n = n;
	}
	}



6-11

class PrintTask implements Runnable{
    private int n;
	public PrintTask(int n) {
		this.n = n;
	}
	@Override
	public void run() {
		for(int i=0;i<n;i++)
			System.out.println(i);
		System.out.println(Thread.currentThread().getName());
	}
	
	
}

6-3

 new Thread(new Runnable() {
  @Override
	public void run() {
		System.out.println(mainThreadName);
		System.out.println(Thread.currentThread().getName());
		System.out.println(Arrays.toString(getClass().getInterfaces()));
	}
});